﻿namespace Framework.ObjectPool
{
    /// <summary>
    /// 对象池管理接口
    /// </summary>
    public interface IObjectPoolManager
    {
        /// <summary>
        /// 获得对象池的数量
        /// </summary>
        int Count
        {
            get;
        }
        /// <summary>
        /// 创建指定类型的对象池
        /// </summary>
        /// <typeparam name="T">要创建的对象池的类型</typeparam>
        /// <returns>创建的对象池</returns>
        IObjectPool<T> CreateObjectPool<T>() where T : ObjectBase, new();
        /// <summary>
        /// 创建指定类型的对象池
        /// </summary>
        /// <typeparam name="T">要创建的对象池的类型</typeparam>
        /// <param name="expireTime">对象池过期时间</param>
        /// <returns>创建的对象池</returns>
        IObjectPool<T> CreateObjectPool<T>(float expireTime) where T : ObjectBase, new();
        /// <summary>
        /// 创建指定类型的对象池
        /// </summary>
        /// <typeparam name="T">要创建的对象池的类型</typeparam>
        /// <param name="capatity">对象池容量</param>
        /// <returns>创建的对象池</returns>
        IObjectPool<T> CreateObjectPool<T>(int capatity) where T : ObjectBase, new();
        /// <summary>
        /// 创建指定类型的对象池
        /// </summary>
        /// <typeparam name="T">要创建的对象池的类型</typeparam>
        /// <param name="name">对象池的名称</param>
        /// <returns>创建的对象池</returns>
        IObjectPool<T> CreateObjectPool<T>(string name) where T : ObjectBase, new();
        /// <summary>
        /// 创建指定类型的对象池
        /// </summary>
        /// <typeparam name="T">要创建的对象池的类型</typeparam>
        /// <param name="name">对象池的名称</param>
        /// <param name="expireTime">对象池过期时间</param>
        /// <returns>创建的对象池</returns>
        IObjectPool<T> CreateObjectPool<T>(string name, float expireTime) where T : ObjectBase, new();
        /// <summary>
        /// 创建指定类型的对象池
        /// </summary>
        /// <typeparam name="T">要创建的对象池的类型</typeparam>
        /// <param name="name">对象池的名称</param>
        /// <param name="capatity">对象池的容量</param>
        /// <param name="expireTime">对象池过期时间</param>
        /// <returns>创建的对象池</returns>
        IObjectPool<T> CreateObjectPool<T>(string name, int capatity, float expireTime) where T : ObjectBase, new();
        /// <summary>
        /// 获得指定类型的对象池
        /// </summary>
        /// <typeparam name="T">要获得的对象池的类型</typeparam>
        /// <returns>获得的对象池</returns>
        IObjectPool<T> GetObjectPool<T>() where T : ObjectBase;
        /// <summary>
        /// 获得指定类型的对象池
        /// </summary>
        /// <typeparam name="T">要获得的对象池的类型</typeparam>
        /// <param name="name">对象池的名称</param>
        /// <returns>获得的对象池</returns>
        IObjectPool<T> GetObjectPool<T>(string name) where T : ObjectBase;
        /// <summary>
        /// 是否存在指定类型的对象池
        /// </summary>
        /// <typeparam name="T">要查询的对象池的类型</typeparam>
        /// <returns>是否存在指定类型的对象池</returns>
        bool HasObjectPool<T>() where T : ObjectBase;
        /// <summary>
        /// 是否存在指定类型的对象池
        /// </summary>
        /// <typeparam name="T">要查询的对象池的类型</typeparam>
        /// <param name="name">对象池的名称</param>
        /// <returns>是否存在指定类型的对象池</returns>
        bool HasObjectPool<T>(string name) where T : ObjectBase;
        /// <summary>
        /// 销毁指定类型的对象池
        /// </summary>
        /// <typeparam name="T">要销毁的对象池的类型</typeparam>
        void DestroyObjectPool<T>() where T : ObjectBase;
        /// <summary>
        /// 销毁指定类型的对象池
        /// </summary>
        /// <typeparam name="T">要销毁的对象池的类型</typeparam>
        /// <param name="name">对象池的名称</param>
        void DestroyObjectPool<T>(string name) where T : ObjectBase;
    }
}

